#include "PhysicObject.h"

PhysicObject::PhysicObject(b2BodyType _type, double _x, double _y, std::string _gfxCode, unsigned int _width, unsigned int _height, std::string _tag, std::string _viewMode, std::string _actorType):
GameObject(_x, _y, _gfxCode, _width, _height, _tag, _viewMode, _actorType)
{
	b2BodyDef bDef;
	bDef.position.x = x / Config::PHYSIC_SCALE;
	bDef.position.y = y / Config::PHYSIC_SCALE;
	bDef.type = _type;

	body = Model::getModel()->world->CreateBody(&bDef);
	body->SetUserData(this);
}

PhysicObject::~PhysicObject(void)
{
	Model::getModel()->world->DestroyBody(body);
}


void PhysicObject::addFixture(b2FixtureDef *def)
{
	body->CreateFixture( def );
}

void PhysicObject::update()
{
}
